home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / RAVE.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  42.0 KB  |  1,142 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        RAVE.h
  3.  
  4.      Contains:    Interface for RAVE (Renderer Acceleration Virtual Engine)                            
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.5.4
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __RAVE__
  18. #define __RAVE__
  19.  
  20. #ifndef __CONDITIONALMACROS__
  21. #include <ConditionalMacros.h>
  22. #endif
  23.  
  24. #if TARGET_OS_MAC
  25. #ifndef __MACTYPES__
  26. #include <MacTypes.h>
  27. #endif
  28. #ifndef __QUICKDRAW__
  29. #include <Quickdraw.h>
  30. #endif
  31. #ifndef __QDOFFSCREEN__
  32. #include <QDOffscreen.h>
  33. #endif
  34.  
  35. #endif  /* TARGET_OS_MAC */
  36.  
  37. #if TARGET_OS_WIN32
  38. #include <windows.h>
  39. #ifndef RAVE_NO_DIRECTDRAW
  40. #include <ddraw.h>
  41. #endif  /* !defined(RAVE_NO_DIRECTDRAW) */
  42.  
  43. #endif  /* TARGET_OS_WIN32 */
  44.  
  45.  
  46.  
  47. #if PRAGMA_ONCE
  48. #pragma once
  49. #endif
  50.  
  51. #ifdef __cplusplus
  52. extern "C" {
  53. #endif
  54.  
  55. #if PRAGMA_IMPORT
  56. #pragma import on
  57. #endif
  58.  
  59. #if PRAGMA_STRUCT_ALIGN
  60.     #pragma options align=power
  61. #elif PRAGMA_STRUCT_PACKPUSH
  62.     #pragma pack(push, 2)
  63. #elif PRAGMA_STRUCT_PACK
  64.     #pragma pack(2)
  65. #endif
  66.  
  67. #if PRAGMA_ENUM_ALWAYSINT
  68.     #pragma enumsalwaysint on
  69. #elif PRAGMA_ENUM_OPTIONS
  70.     #pragma option enum=int
  71. #elif PRAGMA_ENUM_PACK
  72.     #if __option(pack_enums)
  73.         #define PRAGMA_ENUM_PACK__RAVE__
  74.     #endif
  75.     #pragma options(!pack_enums)
  76. #endif
  77.  
  78.  
  79. /******************************************************************************
  80.  *
  81.  * Platform macros.
  82.  * This sets kQAPlatform to one of kQAMacOS, kQAWin32, or kQAGeneric.
  83.  * kQAPlatform controls platform-specific compilation switches and types.
  84.  *
  85.  *****************************************************************************/
  86.  
  87. #if !defined(kQAMacOS)
  88. #define    kQAMacOS        1            /* Target is MacOS                    */
  89. #endif
  90.  
  91. #if !defined(kQAGeneric)
  92. #define kQAGeneric        2            /* Target is generic platform        */
  93. #endif
  94.  
  95. #if !defined(kQAWin32)
  96. #define kQAWin32        3            /* Target is Win32                    */
  97. #endif
  98.  
  99. #if defined(_WIN32) || defined(_WINDOWS)
  100.     #define kQAPlatform kQAWin32
  101. #elif !defined(kQAPlatform)
  102.     #define kQAPlatform kQAMacOS
  103. #endif
  104.  
  105.  
  106. /******************************************************************************
  107.  *
  108.  * Export Control
  109.  *
  110.  *****************************************************************************/
  111. #if defined(_MSC_VER)
  112.     /* Microsoft Visual C */
  113.     #if defined(WIN32_RAVEEXPORTING)    
  114.     /* define when building DLL */
  115.         #define    RAVE_EXPORT        __declspec( dllexport )
  116.         #define RAVE_CALL
  117.         #define RAVE_CALLBACK
  118.     #else
  119.         #define RAVE_EXPORT        __declspec( dllimport )
  120.         #define RAVE_CALL        __cdecl
  121.         #define RAVE_CALLBACK    __cdecl
  122.     #endif 
  123.     /* WIN32_RAVEEXPORTING */
  124. #else
  125.     #define RAVE_EXPORT
  126.     #define RAVE_CALL
  127.     #define RAVE_CALLBACK
  128. #endif 
  129. /* _MSC_VER */
  130.  
  131. /******************************************************************************
  132.  *
  133.  * Platform dependent datatypes: TQAImagePixelType, TQADevice, TQAClip, and TQARect.
  134.  *
  135.  *****************************************************************************/
  136.  
  137. enum TQAImagePixelType {
  138.     kQAPixel_Alpha1                = 0,                            /* 1 bit/pixel alpha */
  139.     kQAPixel_RGB16                = 1,                            /* 16 bit/pixel, R=14:10, G=9:5, B=4:0 */
  140.     kQAPixel_ARGB16                = 2,                            /* 16 bit/pixel, A=15, R=14:10, G=9:5, B=4:0 */
  141.     kQAPixel_RGB32                = 3,                            /* 32 bit/pixel, R=23:16, G=15:8, B=7:0 */
  142.     kQAPixel_ARGB32                = 4,                            /* 32 bit/pixel, A=31:24, R=23:16, G=15:8, B=7:0 */
  143.     kQAPixel_CL4                = 5,                            /* 4 bit color look up table, always big endian, ie high 4 bits effect left pixel */
  144.     kQAPixel_CL8                = 6,                            /* 8 bit color look up table */
  145.     kQAPixel_RGB16_565            = 7,                            /* 16 bits/pixel, no alpha, R:5, G:6, B:5 WINDOWS ONLY */
  146.     kQAPixel_RGB24                = 8                                /* 24 bits/pixel, no alpha, R:8, G:8, B:8 WINDOWS ONLY */
  147. };
  148. typedef enum TQAImagePixelType TQAImagePixelType;
  149.  
  150.  
  151. enum TQAColorTableType {
  152.     kQAColorTable_CL8_RGB32        = 0,                            /* 256 entry, 32 bit/pixel, R=23:16, G=15:8, B=7:0 */
  153.     kQAColorTable_CL4_RGB32        = 1                                /* 16 entry, 32 bit/pixel, R=23:16, G=15:8, B=7:0 */
  154. };
  155. typedef enum TQAColorTableType TQAColorTableType;
  156.  
  157. /* Selects target device type */
  158.  
  159. enum TQADeviceType {
  160.     kQADeviceMemory                = 0,                            /* Memory draw context */
  161.     kQADeviceGDevice            = 1,                            /* Macintosh GDevice draw context */
  162.     kQADeviceWin32DC            = 2,                            /* Win32 DC */
  163.     kQADeviceDDSurface            = 3                                /* Win32 DirectDraw Surface */
  164. };
  165. typedef enum TQADeviceType TQADeviceType;
  166.  
  167. /* Generic memory pixmap device */
  168.  
  169. struct TQADeviceMemory {
  170.     long                             rowBytes;                    /* Rowbytes */
  171.     TQAImagePixelType                 pixelType;                    /* Depth, color space, etc. */
  172.     long                             width;                        /* Width in pixels */
  173.     long                             height;                        /* Height in pixels */
  174.     void *                            baseAddr;                    /* Base address of pixmap */
  175. };
  176. typedef struct TQADeviceMemory            TQADeviceMemory;
  177. /* Selects target clip type */
  178.  
  179. enum TQAClipType {
  180.     kQAClipRgn                    = 0,                            /* Macintosh clipRgn with serial number */
  181.     kQAClipWin32Rgn                = 1                                /* Win32 clip region */
  182. };
  183. typedef enum TQAClipType TQAClipType;
  184.  
  185.  
  186. struct TQARect {
  187.     long                             left;
  188.     long                             right;
  189.     long                             top;
  190.     long                             bottom;
  191. };
  192. typedef struct TQARect                    TQARect;
  193. #if TARGET_OS_MAC
  194.  
  195. union TQAPlatformDevice {
  196.     TQADeviceMemory                 memoryDevice;
  197.     GDHandle                         gDevice;
  198. };
  199. typedef union TQAPlatformDevice            TQAPlatformDevice;
  200.  
  201. union TQAPlatformClip {
  202.     RgnHandle                         clipRgn;
  203. };
  204. typedef union TQAPlatformClip            TQAPlatformClip;
  205. typedef CALLBACK_API( void , TQADrawNotificationProcPtr )(short left, short top, short right, short bottom, long refCon);
  206.  
  207. typedef long                             TQADrawNotificationProcRefNum;
  208. /* used to unregister your proc */
  209. #elif TARGET_OS_WIN32
  210.  
  211. #if !defined(RAVE_NO_DIRECTDRAW)
  212.  
  213.     enum TQADirectDrawObjectSelector
  214.     {
  215.         kQADirectDrawObject        = 1,
  216.         kQADirectDrawObject2    = 2
  217.     };
  218.     typedef enum TQADirectDrawObjectSelector TQADirectDrawObjectSelector;
  219.  
  220.     enum TQADirectDrawSurfaceSelector
  221.     {
  222.         kQADirectDrawSurface    = 1,
  223.         kQADirectDrawSurface2    = 2
  224.     };
  225.     typedef enum TQADirectDrawSurfaceSelector TQADirectDrawSurfaceSelector;
  226.  
  227. #endif /* !RAVE_NO_DIRECTDRAW */
  228.  
  229.     union TQAPlatformDevice
  230.     {
  231.         TQADeviceMemory            memoryDevice;
  232.         HDC                        hdc;
  233. #if !defined(RAVE_NO_DIRECTDRAW)
  234.         struct
  235.         {
  236.             TQADirectDrawObjectSelector        objectSelector;
  237.             union
  238.             {
  239.                 LPDIRECTDRAW                lpDirectDraw;
  240.                 LPDIRECTDRAW2                lpDirectDraw2;
  241.             };
  242.  
  243.             TQADirectDrawSurfaceSelector    surfaceSelector;
  244.             union
  245.             {
  246.                 LPDIRECTDRAWSURFACE            lpDirectDrawSurface;
  247.                 LPDIRECTDRAWSURFACE2        lpDirectDrawSurface2;
  248.             };
  249.         };
  250. #endif /* RAVE_NO_DIRECTDRAW */
  251.     };
  252.     typedef union TQAPlatformDevice TQAPlatformDevice;
  253.     
  254.     union TQAPlatformClip
  255.     {
  256.         HRGN            clipRgn;
  257.     };
  258.     typedef union TQAPlatformClip TQAPlatformClip;
  259.  
  260. #else
  261. /*
  262.      * Generic platform supports memory device only. TQARect is generic. TQAClip is ???.
  263.      */
  264.  
  265. union TQAPlatformDevice {
  266.     TQADeviceMemory                 memoryDevice;
  267. };
  268. typedef union TQAPlatformDevice            TQAPlatformDevice;
  269.  
  270. union TQAPlatformClip {
  271.     void *                            region;                        /* ??? */
  272. };
  273. typedef union TQAPlatformClip            TQAPlatformClip;
  274. #endif  /*  */
  275.  
  276.  
  277. struct TQADevice {
  278.     TQADeviceType                     deviceType;
  279.     TQAPlatformDevice                 device;
  280. };
  281. typedef struct TQADevice                TQADevice;
  282.  
  283. struct TQAClip {
  284.     TQAClipType                     clipType;
  285.     TQAPlatformClip                 clip;
  286. };
  287. typedef struct TQAClip                    TQAClip;
  288. /******************************************************************************
  289.  *
  290.  * Basic data types.
  291.  *
  292.  *****************************************************************************/
  293.  
  294. /* Pointer to a drawing engine */
  295. typedef struct TQAEngine TQAEngine;
  296. /* Pointer to an allocated texture */
  297. typedef struct TQATexture TQATexture;
  298. /* Pointer to an allocated bitmap */
  299. typedef struct TQABitmap TQABitmap;
  300. /* Engine's private draw context pointer */
  301. typedef struct TQADrawPrivate TQADrawPrivate;
  302. /* An engine specific color table structure */
  303. typedef struct TQAColorTable TQAColorTable;
  304. /* A single triangle element for QADrawTriMesh */
  305.  
  306. struct TQAIndexedTriangle {
  307.     unsigned long                     triangleFlags;                /* Triangle flags, see kQATriFlags_ */
  308.     unsigned long                     vertices[3];                /* Indices into a vertex array */
  309. };
  310. typedef struct TQAIndexedTriangle        TQAIndexedTriangle;
  311. /* An image for use as texture or bitmap */
  312.  
  313. struct TQAImage {
  314.     long                             width;                        /* Width of pixmap */
  315.     long                             height;                        /* Height of pixmap */
  316.     long                             rowBytes;                    /* Rowbytes of pixmap */
  317.     void *                            pixmap;                        /* Pixmap */
  318. };
  319. typedef struct TQAImage                    TQAImage;
  320. /* Standard error type */
  321.  
  322. enum TQAError {
  323.     kQANoErr                    = 0,                            /* No error */
  324.     kQAError                    = 1,                            /* Generic error flag */
  325.     kQAOutOfMemory                = 2,                            /* Insufficient memory */
  326.     kQANotSupported                = 3,                            /* Requested feature is not supported */
  327.     kQAOutOfDate                = 4,                            /* A newer drawing engine was registered */
  328.     kQAParamErr                    = 5,                            /* Error in passed parameters */
  329.     kQAGestaltUnknown            = 6,                            /* Requested gestalt type isn't available */
  330.     kQADisplayModeUnsupported    = 7,                            /* Engine cannot render to the display in its current , */
  331.                                                                 /* mode, but could if it were in some other mode */
  332.     kQAOutOfVideoMemory            = 8                                /* There is not enough VRAM to support the desired context dimensions */
  333. };
  334. typedef enum TQAError TQAError;
  335.  
  336. /************************************************************************************************
  337.  *
  338.  * Vertex data types.
  339.  *
  340.  ***********************************************************************************************/
  341. /*
  342.  * TQAVGouraud is used for Gouraud shading. Each vertex specifies position, color and Z.
  343.  *
  344.  * Alpha is always treated as indicating transparency. Drawing engines which don't
  345.  * support Z-sorted rendering use the back-to-front transparency blending functions
  346.  * shown below. (ARGBsrc are the source (new) values, ARGBdest are  the destination
  347.  * (previous) pixel values.)
  348.  *
  349.  *        Premultiplied                            Interpolated
  350.  *
  351.  *        A = 1 - (1 - Asrc) * (1 - Adest)        A = 1 - (1 - Asrc) * (1 - Adest) 
  352.  *        R = (1 - Asrc) * Rdest + Rsrc            R = (1 - Asrc) * Rdest + Asrc * Rsrc
  353.  *        G = (1 - Asrc) * Gdest + Gsrc            G = (1 - Asrc) * Gdest + Asrc * Gsrc
  354.  *        B = (1 - Asrc) * Bdest + Bsrc            B = (1 - Asrc) * Bdest + Asrc * Bsrc
  355.  *
  356.  * Note that the use of other blending modes to implement antialiasing is performed
  357.  * automatically by the drawing engine when the kQATag_Antialias variable !=
  358.  * kQAAntiAlias_Fast. The driving software should continue to use the alpha fields
  359.  * for transparency even when antialiasing is being used (the drawing engine will
  360.  * resolve the multiple blending requirements as best as it can).
  361.  *
  362.  * Drawing engines which perform front-to-back Z-sorted rendering should replace
  363.  * the blending function shown above with the equivalent front-to-back formula.
  364.  */
  365.  
  366. struct TQAVGouraud {
  367.     float                             x;                            /* X pixel coordinate, 0.0 <= x < width */
  368.     float                             y;                            /* Y pixel coordinate, 0.0 <= y < height */
  369.     float                             z;                            /* Z coordinate, 0.0 <= z <= 1.0 */
  370.     float                             invW;                        /* 1 / w; required only when kQAPerspectiveZ_On is set */
  371.  
  372.     float                             r;                            /* Red, 0.0 <= r <= 1.0 */
  373.     float                             g;                            /* Green, 0.0 <= g <= 1.0 */
  374.     float                             b;                            /* Blue, 0.0 <= b <= 1.0 */
  375.     float                             a;                            /* Alpha, 0.0 <= a <= 1.0, 1.0 is opaque */
  376. };
  377. typedef struct TQAVGouraud                TQAVGouraud;
  378. /*
  379.  * TQAVTexture is used for texture mapping. The texture mapping operation
  380.  * is controlled by the kQATag_TextureOp variable, which is a mask of
  381.  * kQATextureOp_None/Modulate/Highlight/Decal. Below is pseudo-code for the
  382.  * texture shading operation:
  383.  *
  384.  *        texPix = TextureLookup (uq/q, vq/q);
  385.  *        if (kQATextureOp_Decal)
  386.  *        {
  387.  *            texPix.r = texPix.a * texPix.r + (1 - texPix.a) * r;
  388.  *            texPix.g = texPix.a * texPix.g + (1 - texPix.a) * g;
  389.  *            texPix.b = texPix.a * texPix.b + (1 - texPix.a) * b;
  390.  *            texPix.a = a;
  391.  *        }
  392.  *        else
  393.  *        {
  394.  *            texPix.a = texPix.a * a;
  395.  *        }
  396.  *        if (kQATextureOp_Modulate)
  397.  *        {
  398.  *            texPix.r *= kd_r;        // Clamped to prevent overflow
  399.  *            texPix.g *= kd_g;        // Clamped to prevent overflow
  400.  *            texPix.b *= kd_b;        // Clamped to prevent overflow
  401.  *        }
  402.  *        if (kQATextureOp_Highlight)
  403.  *        {
  404.  *            texPix.r += ks_r;        // Clamped to prevent overflow
  405.  *            texPix.g += ks_g;        // Clamped to prevent overflow
  406.  *            texPix.b += ks_b;        // Clamped to prevent overflow
  407.  *        }
  408.  *
  409.  * After computation of texPix, transparency blending (as shown
  410.  * above for TQAVGouraud) is performed.
  411.  */
  412.  
  413. struct TQAVTexture {
  414.     float                             x;                            /* X pixel coordinate, 0.0 <= x < width */
  415.     float                             y;                            /* Y pixel coordinate, 0.0 <= y < height */
  416.     float                             z;                            /* Z coordinate, 0.0 <= z <= 1.0 */
  417.     float                             invW;                        /* 1 / w (always required) */
  418.  
  419.                                                                 /* rgb are used only when kQATextureOp_Decal is set. a is always required */
  420.  
  421.     float                             r;                            /* Red, 0.0 <= r <= 1.0 */
  422.     float                             g;                            /* Green, 0.0 <= g <= 1.0 */
  423.     float                             b;                            /* Blue, 0.0 <= b <= 1.0 */
  424.     float                             a;                            /* Alpha, 0.0 <= a <= 1.0, 1.0 is opaque */
  425.  
  426.                                                                 /* uOverW and vOverW are required by all modes */
  427.  
  428.     float                             uOverW;                        /* u / w */
  429.     float                             vOverW;                        /* v / w */
  430.  
  431.                                                                 /* kd_r/g/b are used only when kQATextureOp_Modulate is set */
  432.  
  433.     float                             kd_r;                        /* Scale factor for texture red, 0.0 <= kd_r */
  434.     float                             kd_g;                        /* Scale factor for texture green, 0.0 <= kd_g */
  435.     float                             kd_b;                        /* Scale factor for texture blue, 0.0 <= kd_b */
  436.  
  437.                                                                 /* ks_r/g/b are used only when kQATextureOp_Highlight is set */
  438.  
  439.     float                             ks_r;                        /* Red specular highlight, 0.0 <= ks_r <= 1.0 */
  440.     float                             ks_g;                        /* Green specular highlight, 0.0 <= ks_g <= 1.0 */
  441.     float                             ks_b;                        /* Blue specular highlight, 0.0 <= ks_b <= 1.0 */
  442. };
  443. typedef struct TQAVTexture                TQAVTexture;
  444. /************************************************************************************************
  445.  *
  446.  * Constants used for the state variables.
  447.  *
  448.  ***********************************************************************************************/
  449. /*
  450.  * kQATag_xxx is used to select a state variable when calling QASetFloat(), QASetInt(),
  451.  * QAGetFloat() and QAGetInt(). The kQATag values are split into two separate
  452.  * enumerated types: TQATagInt and TQATagFloat. TQATagInt is used for the QASet/GetInt()
  453.  * functions, and TQATagFloat is used for the QASet/GetFloat() functions. (This is so
  454.  * that a compiler that typechecks enums can flag a float/int tag mismatch during compile.)
  455.  *
  456.  * These variables are required by all drawing engines:
  457.  *        kQATag_ZFunction            (Int)    One of kQAZFunction_xxx
  458.  *        kQATag_ColorBG_a            (Float)    Background color alpha
  459.  *        kQATag_ColorBG_r            (Float)    Background color red
  460.  *        kQATag_ColorBG_g            (Float)    Background color green
  461.  *        kQATag_ColorBG_b            (Float)    Background color blue
  462.  *        kQATag_Width                (Float)    Line and point width (pixels)
  463.  *        kQATag_ZMinOffset            (Float)    Min offset to Z to guarantee visibility (Read only!)
  464.  *        kQATag_ZMinScale            (Float)    Min scale to Z to guarantee visibility (Read only!)
  465.  
  466.  * These variables are used for optional features:
  467.  *        kQATag_Antialias            (Int)    One of kQAAntiAlias_xxx
  468.  *        kQATag_Blend                (Int)    One of kQABlend_xxx
  469.  *        kQATag_PerspectiveZ            (Int)    One of kQAPerspectiveZ_xxx
  470.  *        kQATag_TextureFilter        (Int)    One of kQATextureFilter_xxx
  471.  *        kQATag_TextureOp            (Int)    Mask of kQATextureOp_xxx
  472.  *        kQATag_Texture                (Int)    Pointer to current TQATexture
  473.  *        kQATag_CSGTag                (Int)    One of kQACSGTag_xxx
  474.  *        kQATag_CSGEquation            (Int)    32 bit CSG truth table
  475.  *
  476.  * These variables are used for OpenGL™ support:
  477.  *        kQATagGL_DrawBuffer            (Int)    Mask of kQAGL_DrawBuffer_xxx
  478.  *        kQATagGL_TextureWrapU        (Int)    kQAGL_Clamp or kQAGL_Repeat
  479.  *        kQATagGL_TextureWrapV        (Int)    kQAGL_Clamp or kQAGL_Repeat
  480.  *        kQATagGL_TextureMagFilter    (Int)    kQAGL_Nearest or kQAGL_Linear
  481.  *        kQATagGL_TextureMinFilter    (Int)    kQAGL_Nearest, etc.
  482.  *        kQATagGL_ScissorXMin        (Int)    Minimum X value for scissor rectangle
  483.  *        kQATagGL_ScissorYMin        (Int)    Minimum Y value for scissor rectangle
  484.  *        kQATagGL_ScissorXMax        (Int)    Maximum X value for scissor rectangle
  485.  *        kQATagGL_ScissorYMax        (Int)    Maximum Y value for scissor rectangle
  486.  *        kQATagGL_BlendSrc            (Int)    Source blending operation
  487.  *        kQATagGL_BlendDst            (Int)    Destination blending operation
  488.  *        kQATagGL_LinePattern        (Int)    Line rasterization pattern
  489.  *        kQATagGL_AreaPattern0        (Int)    First of 32 area pattern registers
  490.  *        kQATagGL_AreaPattern31        (Int)    Last of 32 area pattern registers
  491.  *        kQATagGL_DepthBG            (Float)    Background Z
  492.  *        kQATagGL_TextureBorder_a    (Float)    Texture border color alpha
  493.  *        kQATagGL_TextureBorder_r    (Float)    Texture border color red
  494.  *        kQATagGL_TextureBorder_g    (Float)    Texture border color green
  495.  *        kQATagGL_TextureBorder_b    (Float)    Texture border color blue
  496.  *
  497.  * Tags >= kQATag_EngineSpecific_Minimum may be assigned by the vendor for use as
  498.  * engine-specific variables. NOTE: These should be used only in exceptional circumstances,
  499.  * as functions performed by these variables won't be generally accessible. All other tag
  500.  * values are reserved.
  501.  *
  502.  *        kQATag_EngineSpecific_Minimum    Minimum tag value for drawing-engine specific variables
  503.  */
  504.  
  505. enum TQATagInt {
  506.     kQATag_ZFunction            = 0,
  507.     kQATag_Antialias            = 8,
  508.     kQATag_Blend                = 9,
  509.     kQATag_PerspectiveZ            = 10,
  510.     kQATag_TextureFilter        = 11,
  511.     kQATag_TextureOp            = 12,
  512.     kQATag_CSGTag                = 14,
  513.     kQATag_CSGEquation            = 15,
  514.     kQATag_BufferComposite        = 16,
  515.     kQATagGL_DrawBuffer            = 100,
  516.     kQATagGL_TextureWrapU        = 101,
  517.     kQATagGL_TextureWrapV        = 102,
  518.     kQATagGL_TextureMagFilter    = 103,
  519.     kQATagGL_TextureMinFilter    = 104,
  520.     kQATagGL_ScissorXMin        = 105,
  521.     kQATagGL_ScissorYMin        = 106,
  522.     kQATagGL_ScissorXMax        = 107,
  523.     kQATagGL_ScissorYMax        = 108,
  524.     kQATagGL_BlendSrc            = 109,
  525.     kQATagGL_BlendDst            = 110,
  526.     kQATagGL_LinePattern        = 111,
  527.     kQATagGL_AreaPattern0        = 117,                            /* ...1-30 */
  528.     kQATagGL_AreaPattern31        = 148,
  529.     kQATag_EngineSpecific_Minimum = 1000
  530. };
  531. typedef enum TQATagInt TQATagInt;
  532.  
  533.  
  534. enum TQATagPtr {
  535.     kQATag_Texture                = 13
  536. };
  537. typedef enum TQATagPtr TQATagPtr;
  538.  
  539.  
  540. enum TQATagFloat {
  541.     kQATag_ColorBG_a            = 1,
  542.     kQATag_ColorBG_r            = 2,
  543.     kQATag_ColorBG_g            = 3,
  544.     kQATag_ColorBG_b            = 4,
  545.     kQATag_Width                = 5,
  546.     kQATag_ZMinOffset            = 6,
  547.     kQATag_ZMinScale            = 7,
  548.     kQATagGL_DepthBG            = 112,
  549.     kQATagGL_TextureBorder_a    = 113,
  550.     kQATagGL_TextureBorder_r    = 114,
  551.     kQATagGL_TextureBorder_g    = 115,
  552.     kQATagGL_TextureBorder_b    = 116
  553. };
  554. typedef enum TQATagFloat TQATagFloat;
  555.  
  556. /* kQATag_ZFunction */
  557.  
  558. enum {
  559.     kQAZFunction_None            = 0,                            /* Z is neither tested nor written (same as no Z buffer) */
  560.     kQAZFunction_LT                = 1,                            /* Znew < Zbuffer is visible */
  561.     kQAZFunction_EQ                = 2,                            /* OpenGL Only: Znew == Zbuffer is visible */
  562.     kQAZFunction_LE                = 3,                            /* OpenGL Only: Znew <= Zbuffer is visible */
  563.     kQAZFunction_GT                = 4,                            /* OpenGL Only: Znew > Zbuffer is visible */
  564.     kQAZFunction_NE                = 5,                            /* OpenGL Only: Znew != Zbuffer is visible */
  565.     kQAZFunction_GE                = 6,                            /* OpenGL Only: Znew >= Zbuffer is visible */
  566.     kQAZFunction_True            = 7                                /* Znew is always visible */
  567. };
  568.  
  569. /* kQATag_Width */
  570. #define kQAMaxWidth 128.0
  571. /* kQATag_Antialias */
  572.  
  573. enum {
  574.     kQAAntiAlias_Off            = 0,
  575.     kQAAntiAlias_Fast            = 1,
  576.     kQAAntiAlias_Mid            = 2,
  577.     kQAAntiAlias_Best            = 3
  578. };
  579.  
  580. /* kQATag_Blend */
  581.  
  582. enum {
  583.     kQABlend_PreMultiply        = 0,
  584.     kQABlend_Interpolate        = 1,
  585.     kQABlend_OpenGL                = 2
  586. };
  587.  
  588. /* kQATag_BufferComposite */
  589.  
  590. enum {
  591.     kQABufferComposite_None        = 0,                            /* Default: New pixels overwrite initial buffer contents */
  592.     kQABufferComposite_PreMultiply = 1,                            /* New pixels are blended with initial buffer contents via PreMultiply */
  593.     kQABufferComposite_Interpolate = 2                            /* New pixels are blended with initial buffer contents via Interpolate */
  594. };
  595.  
  596. /* kQATag_PerspectiveZ */
  597.  
  598. enum {
  599.     kQAPerspectiveZ_Off            = 0,                            /* Use Z for hidden surface removal */
  600.     kQAPerspectiveZ_On            = 1                                /* Use InvW for hidden surface removal */
  601. };
  602.  
  603. /* kQATag_TextureFilter */
  604.  
  605. enum {
  606.                                                                 /* suggested meanings of these values */
  607.     kQATextureFilter_Fast        = 0,                            /* No filtering, pick nearest */
  608.     kQATextureFilter_Mid        = 1,                            /* Fastest method that does some filtering */
  609.     kQATextureFilter_Best        = 2                                /* Highest quality renderer can do */
  610. };
  611.  
  612. /* kQATag_TextureOp (mask of one or more) */
  613.  
  614. enum {
  615.     kQATextureOp_None            = 0,                            /* Default texture mapping mode */
  616.     kQATextureOp_Modulate        = (1 << 0),                        /* Modulate texture color with kd_r/g/b */
  617.     kQATextureOp_Highlight        = (1 << 1),                        /* Add highlight value ks_r/g/b */
  618.     kQATextureOp_Decal            = (1 << 2),                        /* When texture alpha == 0, use rgb instead */
  619.     kQATextureOp_Shrink            = (1 << 3)                        /* This is a non-wrapping texture, so the ??? */
  620. };
  621.  
  622. /* kQATag_CSGTag */
  623. #define kQACSGTag_None 0xffffffffUL
  624.  
  625. enum {
  626.     kQACSGTag_0                    = 0,                            /* Submitted tris have CSG ID 0 */
  627.     kQACSGTag_1                    = 1,                            /* Submitted tris have CSG ID 1 */
  628.     kQACSGTag_2                    = 2,                            /* Submitted tris have CSG ID 2 */
  629.     kQACSGTag_3                    = 3,                            /* Submitted tris have CSG ID 3 */
  630.     kQACSGTag_4                    = 4                                /* Submitted tris have CSG ID 4 */
  631. };
  632.  
  633. /* kQATagGL_TextureWrapU/V */
  634.  
  635. enum {
  636.     kQAGL_Repeat                = 0,
  637.     kQAGL_Clamp                    = 1
  638. };
  639.  
  640. /* kQATagGL_BlendSrc */
  641.  
  642. enum {
  643.     kQAGL_SourceBlend_XXX        = 0
  644. };
  645.  
  646. /* kQATagGL_BlendDst */
  647.  
  648. enum {
  649.     kQAGL_DestBlend_XXX            = 0
  650. };
  651.  
  652. /* kQATagGL_DrawBuffer (mask of one or more) */
  653.  
  654. enum {
  655.     kQAGL_DrawBuffer_None        = 0,
  656.     kQAGL_DrawBuffer_FrontLeft    = (1 << 0),
  657.     kQAGL_DrawBuffer_FrontRight    = (1 << 1),
  658.     kQAGL_DrawBuffer_BackLeft    = (1 << 2),
  659.     kQAGL_DrawBuffer_BackRight    = (1 << 3),
  660.     kQAGL_DrawBuffer_Front        = (kQAGL_DrawBuffer_FrontLeft | kQAGL_DrawBuffer_FrontRight),
  661.     kQAGL_DrawBuffer_Back        = (kQAGL_DrawBuffer_BackLeft | kQAGL_DrawBuffer_BackRight)
  662. };
  663.  
  664. /************************************************************************************************
  665.  *
  666.  * Constants used as function parameters.
  667.  *
  668.  ***********************************************************************************************/
  669. /*
  670.  * TQAVertexMode is a parameter to QADrawVGouraud() and QADrawVTexture() that specifies how
  671.  * to interpret and draw the vertex array.
  672.  */
  673.  
  674. enum TQAVertexMode {
  675.     kQAVertexMode_Point            = 0,                            /* Draw nVertices points */
  676.     kQAVertexMode_Line            = 1,                            /* Draw nVertices/2 line segments */
  677.     kQAVertexMode_Polyline        = 2,                            /* Draw nVertices-1 connected line segments */
  678.     kQAVertexMode_Tri            = 3,                            /* Draw nVertices/3 triangles */
  679.     kQAVertexMode_Strip            = 4,                            /* Draw nVertices-2 triangles as a strip */
  680.     kQAVertexMode_Fan            = 5,                            /* Draw nVertices-2 triangles as a fan from v0 */
  681.     kQAVertexMode_NumModes        = 6
  682. };
  683. typedef enum TQAVertexMode TQAVertexMode;
  684.  
  685. /*
  686.  * TQAGestaltSelector is a parameter to QAEngineGestalt(). It selects which gestalt
  687.  * parameter will be copied into 'response'.
  688.  */
  689.  
  690. enum TQAGestaltSelector {
  691.     kQAGestalt_OptionalFeatures    = 0,                            /* Mask of one or more kQAOptional_xxx */
  692.     kQAGestalt_FastFeatures        = 1,                            /* Mask of one or more kQAFast_xxx */
  693.     kQAGestalt_VendorID            = 2,                            /* Vendor ID */
  694.     kQAGestalt_EngineID            = 3,                            /* Engine ID */
  695.     kQAGestalt_Revision            = 4,                            /* Revision number of this engine */
  696.     kQAGestalt_ASCIINameLength    = 5,                            /* strlen (asciiName) */
  697.     kQAGestalt_ASCIIName        = 6,                            /* Causes strcpy (response, asciiName) */
  698.     kQAGestalt_TextureMemory    = 7,                            /* amount of texture RAM currently available */
  699.     kQAGestalt_FastTextureMemory = 8,                            /* amount of texture RAM currently available */
  700.     kQAGestalt_NumSelectors        = 9
  701. };
  702. typedef enum TQAGestaltSelector TQAGestaltSelector;
  703.  
  704. /*
  705.  * TQAMethodSelector is a parameter to QASetNoticeMethod to select the notice method
  706.  */
  707.  
  708. enum TQAMethodSelector {
  709.     kQAMethod_RenderCompletion    = 0,                            /* Called when rendering has completed and buffers swapped */
  710.     kQAMethod_DisplayModeChanged = 1,                            /* Called when a display mode has changed */
  711.     kQAMethod_ReloadTextures    = 2,                            /* Called when texture memory has been invalidated */
  712.     kQAMethod_BufferInitialize    = 3,                            /* Called when a buffer needs to be initialized */
  713.     kQAMethod_BufferComposite    = 4,                            /* Called when rendering is finished and its safe to composite */
  714.     kQAMethod_NumSelectors        = 5
  715. };
  716. typedef enum TQAMethodSelector TQAMethodSelector;
  717.  
  718. /*
  719.  * kQATriFlags_xxx are ORed together to generate the 'flags' parameter
  720.  * to QADrawTriGouraud() and QADrawTriTexture().
  721.  */
  722.  
  723. enum {
  724.     kQATriFlags_None            = 0,                            /* No flags (triangle is front-facing or don't care) */
  725.     kQATriFlags_Backfacing        = (1 << 0)                        /* Triangle is back-facing */
  726. };
  727.  
  728. /*
  729.  * kQATexture_xxx are ORed together to generate the 'flags' parameter to QATextureNew().
  730.  */
  731.  
  732. enum {
  733.     kQATexture_None                = 0,                            /* No flags */
  734.     kQATexture_Lock                = (1 << 0),                        /* Don't swap this texture out */
  735.     kQATexture_Mipmap            = (1 << 1),                        /* This texture is mipmapped */
  736.     kQATexture_NoCompression    = (1 << 2),                        /* Do not compress this texture */
  737.     kQATexture_HighCompression    = (1 << 3)                        /* Compress texture, even if it takes a while */
  738. };
  739.  
  740. /*
  741.  * kQABitmap_xxx are ORed together to generate the 'flags' parameter to QABitmapNew().
  742.  */
  743.  
  744. enum {
  745.     kQABitmap_None                = 0,                            /* No flags */
  746.     kQABitmap_Lock                = (1 << 1),                        /* Don't swap this bitmap out */
  747.     kQABitmap_NoCompression        = (1 << 2),                        /* Do not compress this bitmap */
  748.     kQABitmap_HighCompression    = (1 << 3)                        /* Compress bitmap, even if it takes a while */
  749. };
  750.  
  751. /*
  752.  * kQAContext_xxx are ORed together to generate the 'flags' parameter for QADrawContextNew().
  753.  */
  754.  
  755. enum {
  756.     kQAContext_None                = 0,                            /* No flags */
  757.     kQAContext_NoZBuffer        = (1 << 0),                        /* No hidden surface removal */
  758.     kQAContext_DeepZ            = (1 << 1),                        /* Hidden surface precision >= 24 bits */
  759.     kQAContext_DoubleBuffer        = (1 << 2),                        /* Double buffered window */
  760.     kQAContext_Cache            = (1 << 3),                        /* This is a cache context */
  761.     kQAContext_NoDither            = (1 << 4)                        /* No dithering, straight color banding */
  762. };
  763.  
  764. /*
  765.  * kQAOptional_xxx are ORed together to generate the kQAGestalt_OptionalFeatures response
  766.  * from QAEngineGestalt().
  767.  */
  768.  
  769. enum {
  770.     kQAOptional_None            = 0,                            /* No optional features */
  771.     kQAOptional_DeepZ            = (1 << 0),                        /* Hidden surface precision >= 24 bits */
  772.     kQAOptional_Texture            = (1 << 1),                        /* Texture mapping */
  773.     kQAOptional_TextureHQ        = (1 << 2),                        /* High quality texture (tri-linear mip or better) */
  774.     kQAOptional_TextureColor    = (1 << 3),                        /* Full color modulation and highlight of textures */
  775.     kQAOptional_Blend            = (1 << 4),                        /* Transparency blending of RGB */
  776.     kQAOptional_BlendAlpha        = (1 << 5),                        /* Transparency blending includes alpha channel */
  777.     kQAOptional_Antialias        = (1 << 6),                        /* Antialiased rendering */
  778.     kQAOptional_ZSorted            = (1 << 7),                        /* Z sorted rendering (for transparency, etc.) */
  779.     kQAOptional_PerspectiveZ    = (1 << 8),                        /* Hidden surface removal using InvW instead of Z */
  780.     kQAOptional_OpenGL            = (1 << 9),                        /* Extended rasterization features for OpenGL™ */
  781.     kQAOptional_NoClear            = (1 << 10),                    /* This drawing engine doesn't clear before drawing */
  782.     kQAOptional_CSG                = (1 << 11),                    /* kQATag_CSGxxx are implemented */
  783.     kQAOptional_BoundToDevice    = (1 << 12),                    /* This engine is tightly bound to GDevice */
  784.     kQAOptional_CL4                = (1 << 13),                    /* This engine suports kQAPixel_CL4 */
  785.     kQAOptional_CL8                = (1 << 14),                    /* This engine suports kQAPixel_CL8 */
  786.     kQAOptional_BufferComposite    = (1 << 15),                    /* This engine can composite with initial buffer contents */
  787.     kQAOptional_NoDither        = (1 << 16)                        /* This engine can draw with no dithering */
  788. };
  789.  
  790. /*
  791.  * kQAFast_xxx are ORed together to generate the kQAGestalt_FastFeatures response
  792.  * from QAEngineGestalt().
  793.  */
  794.  
  795. enum {
  796.     kQAFast_None                = 0,                            /* No accelerated features */
  797.     kQAFast_Line                = (1 << 0),                        /* Line drawing */
  798.     kQAFast_Gouraud                = (1 << 1),                        /* Gouraud shaded triangles */
  799.     kQAFast_Texture                = (1 << 2),                        /* Texture mapped triangles */
  800.     kQAFast_TextureHQ            = (1 << 3),                        /* High quality texture (tri-linear mip or better) */
  801.     kQAFast_Blend                = (1 << 4),                        /* Transparency blending */
  802.     kQAFast_Antialiasing        = (1 << 5),                        /* Antialiased rendering */
  803.     kQAFast_ZSorted                = (1 << 6),                        /* Z sorted rendering of non-opaque objects */
  804.     kQAFast_CL4                    = (1 << 7),                        /* This engine accelerates kQAPixel_CL4 */
  805.     kQAFast_CL8                    = (1 << 8)                        /* This engine accelerates kQAPixel_CL8 */
  806. };
  807.  
  808.  
  809. /************************************************************************************************
  810.  *
  811.  * Macro definitions for the drawing engine methods included in TQADrawContext. These
  812.  * macros are the recommended means of accessing the engine's draw methods, e.g:
  813.  *
  814.  *        TQADrawContext    *drawContext;
  815.  *        TQAVTexture        vertices[3];
  816.  *
  817.  *        drawContext = QADrawContextNew (rect, gdevice, engine, kQAContext_ZBuffer);
  818.  *        ...
  819.  *        QASetInt (drawContext, kQATag_ZFunction, kQAZFunction_LT);
  820.  *        QADrawTriGouraud (drawContext, &vertices[0], &vertices[1], &vertices[2], kQATriFlags_None);
  821.  *
  822.  * Note that QARenderStart(), QARenderEnd(), QAFlush() and QASync() have real function
  823.  * definitions instead of macros. This is because these functions can afford the extra
  824.  * per-call overhead of a function layer (which makes application code a little smaller),
  825.  * and to allow a cleaner implementation of handling NULL parameters to QARenderStart().
  826.  *
  827.  ***********************************************************************************************/
  828.  
  829.  
  830. #define QASetFloat(drawContext,tag,newValue) \
  831.         (drawContext)->setFloat (drawContext,tag,newValue)
  832.  
  833. #define QASetInt(drawContext,tag,newValue) \
  834.         (drawContext)->setInt (drawContext,tag,newValue)
  835.  
  836. #define QASetPtr(drawContext,tag,newValue) \
  837.         (drawContext)->setPtr (drawContext,tag,newValue)
  838.  
  839. #define QAGetFloat(drawContext,tag) \
  840.         (drawContext)->getFloat (drawContext,tag)
  841.  
  842. #define QAGetInt(drawContext,tag) \
  843.         (drawContext)->getInt (drawContext,tag)
  844.  
  845. #define QAGetPtr(drawContext,tag) \
  846.         (drawContext)->getPtr (drawContext,tag)
  847.  
  848. #define QADrawPoint(drawContext,v) \
  849.         (drawContext)->drawPoint (drawContext,v)
  850.  
  851. #define QADrawLine(drawContext,v0,v1) \
  852.         (drawContext)->drawLine (drawContext,v0,v1)
  853.  
  854. #define QADrawTriGouraud(drawContext,v0,v1,v2,flags) \
  855.         (drawContext)->drawTriGouraud (drawContext,v0,v1,v2,flags)
  856.  
  857. #define QADrawTriTexture(drawContext,v0,v1,v2,flags) \
  858.         (drawContext)->drawTriTexture (drawContext,v0,v1,v2,flags)
  859.  
  860. #define QASubmitVerticesGouraud(drawContext,nVertices,vertices) \
  861.         (drawContext)->submitVerticesGouraud(drawContext,nVertices,vertices)
  862.         
  863. #define QASubmitVerticesTexture(drawContext,nVertices,vertices) \
  864.         (drawContext)->submitVerticesTexture(drawContext,nVertices,vertices)
  865.  
  866.         
  867. #define QADrawTriMeshGouraud(drawContext,nTriangle,triangles) \
  868.         (drawContext)->drawTriMeshGouraud (drawContext,nTriangle,triangles)
  869.  
  870. #define QADrawTriMeshTexture(drawContext,nTriangle,triangles) \
  871.         (drawContext)->drawTriMeshTexture (drawContext,nTriangle,triangles)
  872.  
  873. #define QADrawVGouraud(drawContext,nVertices,vertexMode,vertices,flags) \
  874.         (drawContext)->drawVGouraud (drawContext,nVertices,vertexMode,vertices,flags)
  875.  
  876. #define QADrawVTexture(drawContext,nVertices,vertexMode,vertices,flags) \
  877.         (drawContext)->drawVTexture (drawContext,nVertices,vertexMode,vertices,flags)
  878.  
  879. #define QADrawBitmap(drawContext,v,bitmap) \
  880.         (drawContext)->drawBitmap (drawContext,v,bitmap)
  881.  
  882. #define QARenderStart(drawContext,dirtyRect,initialContext) \
  883.         (drawContext)->renderStart (drawContext,dirtyRect,initialContext)
  884.  
  885. #define QARenderEnd(drawContext,modifiedRect) \
  886.         (drawContext)->renderEnd (drawContext,modifiedRect)
  887.  
  888. #define QARenderAbort(drawContext) \
  889.         (drawContext)->renderAbort (drawContext)
  890.  
  891. #define QAFlush(drawContext) \
  892.         (drawContext)->flush (drawContext)
  893.  
  894. #define QASync(drawContext) \
  895.         (drawContext)->sync (drawContext)
  896.  
  897. #define QASetNoticeMethod(drawContext, method, completionCallBack, refCon) \
  898.         (drawContext)->setNoticeMethod (drawContext, method, completionCallBack, refCon)
  899.  
  900. #define QAGetNoticeMethod(drawContext, method, completionCallBack, refCon) \
  901.         (drawContext)->getNoticeMethod (drawContext, method, completionCallBack, refCon)
  902.  
  903.  
  904.  
  905.  
  906. /********************************************************************
  907.  * TQAVersion sets the TQADrawContext 'version' field. It is set by
  908.  * the manager to indicate the version of the TQADrawContext structure.
  909.  *******************************************************************/
  910.  
  911. enum TQAVersion {
  912.     kQAVersion_Prerelease        = 0,
  913.     kQAVersion_1_0                = 1,
  914.     kQAVersion_1_0_5            = 2,                            /* Added tri mesh functions, color tables */
  915.     kQAVersion_1_5                = 3                                /* Added call backs, texture compression, and new error return code */
  916. };
  917. typedef enum TQAVersion TQAVersion;
  918.  
  919.  
  920.  
  921. /***********************************************************************
  922.  * TQADrawContext structure holds method pointers.
  923.  * This is a forward refrence. The structure is defined later.
  924.  **********************************************************************/
  925. typedef struct TQADrawContext             TQADrawContext;
  926. /************************************************************************************************
  927.  *
  928.  * Typedefs of draw method functions provided by the drawing engine. One function pointer
  929.  * for each of these function types in stored in the TQADrawContext public data structure.
  930.  *
  931.  * These functions should be accessed through the QA<function>(context,...) macros,
  932.  * defined above.
  933.  *
  934.  ***********************************************************************************************/
  935. typedef CALLBACK_API_C( void , TQAStandardNoticeMethod )(const TQADrawContext *drawContext, void *refCon);
  936. typedef CALLBACK_API_C( void , TQABufferNoticeMethod )(const TQADrawContext *drawContext, const TQADevice *buffer, const TQARect *dirtyRect, void *refCon);
  937.  
  938. union TQANoticeMethod {
  939.     TQAStandardNoticeMethod         standardNoticeMethod;        /* Used for non-buffer related methods */
  940.     TQABufferNoticeMethod             bufferNoticeMethod;            /* Used for buffer handling methods */
  941. };
  942. typedef union TQANoticeMethod            TQANoticeMethod;
  943. typedef CALLBACK_API_C( void , TQASetFloat )(TQADrawContext *drawContext, TQATagFloat tag, float newValue);
  944. typedef CALLBACK_API_C( void , TQASetInt )(TQADrawContext *drawContext, TQATagInt tag, unsigned long newValue);
  945. typedef CALLBACK_API_C( void , TQASetPtr )(TQADrawContext *drawContext, TQATagPtr tag, const void *newValue);
  946. typedef CALLBACK_API_C( float , TQAGetFloat )(const TQADrawContext *drawContext, TQATagFloat tag);
  947. typedef CALLBACK_API_C( unsigned long , TQAGetInt )(const TQADrawContext *drawContext, TQATagInt tag);
  948. typedef CALLBACK_API_C( void *, TQAGetPtr )(const TQADrawContext *drawContext, TQATagPtr tag);
  949. typedef CALLBACK_API_C( void , TQADrawPoint )(const TQADrawContext *drawContext, const TQAVGouraud *v);
  950. typedef CALLBACK_API_C( void , TQADrawLine )(const TQADrawContext *drawContext, const TQAVGouraud *v0, const TQAVGouraud *v1);
  951. typedef CALLBACK_API_C( void , TQADrawTriGouraud )(const TQADrawContext *drawContext, const TQAVGouraud *v0, const TQAVGouraud *v1, const TQAVGouraud *v2, unsigned long flags);
  952. typedef CALLBACK_API_C( void , TQADrawTriTexture )(const TQADrawContext *drawContext, const TQAVTexture *v0, const TQAVTexture *v1, const TQAVTexture *v2, unsigned long flags);
  953. typedef CALLBACK_API_C( void , TQASubmitVerticesGouraud )(const TQADrawContext *drawContext, unsigned long nVertices, const TQAVGouraud *vertices);
  954. typedef CALLBACK_API_C( void , TQASubmitVerticesTexture )(const TQADrawContext *drawContext, unsigned long nVertices, const TQAVTexture *vertices);
  955. typedef CALLBACK_API_C( void , TQADrawTriMeshGouraud )(const TQADrawContext *drawContext, unsigned long nTriangles, const TQAIndexedTriangle *triangles);
  956. typedef CALLBACK_API_C( void , TQADrawTriMeshTexture )(const TQADrawContext *drawContext, unsigned long nTriangles, const TQAIndexedTriangle *triangles);
  957. typedef CALLBACK_API_C( void , TQADrawVGouraud )(const TQADrawContext *drawContext, unsigned long nVertices, TQAVertexMode vertexMode, const TQAVGouraud vertices[], const unsigned long flags[]);
  958. typedef CALLBACK_API_C( void , TQADrawVTexture )(const TQADrawContext *drawContext, unsigned long nVertices, TQAVertexMode vertexMode, const TQAVTexture vertices[], const unsigned long flags[]);
  959. typedef CALLBACK_API_C( void , TQADrawBitmap )(const TQADrawContext *drawContext, const TQAVGouraud *v, TQABitmap *bitmap);
  960. typedef CALLBACK_API_C( void , TQARenderStart )(const TQADrawContext *drawContext, const TQARect *dirtyRect, const TQADrawContext *initialContext);
  961. typedef CALLBACK_API_C( TQAError , TQARenderEnd )(const TQADrawContext *drawContext, const TQARect *modifiedRect);
  962. typedef CALLBACK_API_C( TQAError , TQARenderAbort )(const TQADrawContext *drawContext);
  963. typedef CALLBACK_API_C( TQAError , TQAFlush )(const TQADrawContext *drawContext);
  964. typedef CALLBACK_API_C( TQAError , TQASync )(const TQADrawContext *drawContext);
  965. typedef CALLBACK_API_C( TQAError , TQASetNoticeMethod )(const TQADrawContext *drawContext, TQAMethodSelector method, TQANoticeMethod completionCallBack, void *refCon);
  966. typedef CALLBACK_API_C( TQAError , TQAGetNoticeMethod )(const TQADrawContext *drawContext, TQAMethodSelector method, TQANoticeMethod *completionCallBack, void **refCon);
  967. /************************************************************************************************
  968.  *
  969.  * Public TQADrawContext structure. This contains function pointers for the chosen
  970.  * drawing engine.
  971.  *
  972.  ***********************************************************************************************/
  973.  
  974. struct TQADrawContext {
  975.     TQADrawPrivate *                drawPrivate;                /* Engine's private data for this context */
  976.     TQAVersion                         version;                    /* Version number */
  977.     TQASetFloat                     setFloat;                    /* Method: Set a float state variable */
  978.     TQASetInt                         setInt;                        /* Method: Set an unsigned long state variable */
  979.     TQASetPtr                         setPtr;                        /* Method: Set an unsigned long state variable */
  980.     TQAGetFloat                     getFloat;                    /* Method: Get a float state variable */
  981.     TQAGetInt                         getInt;                        /* Method: Get an unsigned long state variable */
  982.     TQAGetPtr                         getPtr;                        /* Method: Get an pointer state variable */
  983.     TQADrawPoint                     drawPoint;                    /* Method: Draw a point */
  984.     TQADrawLine                     drawLine;                    /* Method: Draw a line */
  985.     TQADrawTriGouraud                 drawTriGouraud;                /* Method: Draw a Gouraud shaded triangle */
  986.     TQADrawTriTexture                 drawTriTexture;                /* Method: Draw a texture mapped triangle */
  987.     TQADrawVGouraud                 drawVGouraud;                /* Method: Draw Gouraud vertices */
  988.     TQADrawVTexture                 drawVTexture;                /* Method: Draw texture vertices */
  989.     TQADrawBitmap                     drawBitmap;                    /* Method: Draw a bitmap */
  990.     TQARenderStart                     renderStart;                /* Method: Initialize for rendering */
  991.     TQARenderEnd                     renderEnd;                    /* Method: Complete rendering and display */
  992.     TQARenderAbort                     renderAbort;                /* Method: Abort any outstanding rendering (blocking) */
  993.     TQAFlush                         flush;                        /* Method: Start render of any queued commands (non-blocking) */
  994.     TQASync                         sync;                        /* Method: Wait for completion of all rendering (blocking) */
  995.     TQASubmitVerticesGouraud         submitVerticesGouraud;        /* Method: Submit Gouraud vertices for trimesh */
  996.     TQASubmitVerticesTexture         submitVerticesTexture;        /* Method: Submit Texture vertices for trimesh */
  997.     TQADrawTriMeshGouraud             drawTriMeshGouraud;            /* Method: Draw a Gouraud triangle mesh */
  998.     TQADrawTriMeshTexture             drawTriMeshTexture;            /* Method: Draw a Texture triangle mesh */
  999.     TQASetNoticeMethod                 setNoticeMethod;            /* Method: Set a notice method */
  1000.     TQAGetNoticeMethod                 getNoticeMethod;            /* Method: Get a notice method */
  1001. };
  1002.  
  1003. /************************************************************************************************
  1004.  *
  1005.  * Acceleration manager function prototypes.
  1006.  *
  1007.  ***********************************************************************************************/
  1008. EXTERN_API_C( TQAError )
  1009. QADrawContextNew                (const TQADevice *        device,
  1010.                                  const TQARect *        rect,
  1011.                                  const TQAClip *        clip,
  1012.                                  const TQAEngine *        engine,
  1013.                                  unsigned long             flags,
  1014.                                  TQADrawContext **        newDrawContext);
  1015.  
  1016. EXTERN_API_C( void )
  1017. QADrawContextDelete                (TQADrawContext *        drawContext);
  1018.  
  1019. EXTERN_API_C( TQAError )
  1020. QAColorTableNew                    (const TQAEngine *        engine,
  1021.                                  TQAColorTableType         tableType,
  1022.                                  void *                    pixelData,
  1023.                                  long                     transparentIndexFlag,
  1024.                                  TQAColorTable **        newTable);
  1025.  
  1026. EXTERN_API_C( void )
  1027. QAColorTableDelete                (const TQAEngine *        engine,
  1028.                                  TQAColorTable *        colorTable);
  1029.  
  1030. EXTERN_API_C( TQAError )
  1031. QATextureNew                    (const TQAEngine *        engine,
  1032.                                  unsigned long             flags,
  1033.                                  TQAImagePixelType         pixelType,
  1034.                                  const TQAImage         images[],
  1035.                                  TQATexture **            newTexture);
  1036.  
  1037. EXTERN_API_C( TQAError )
  1038. QATextureDetach                    (const TQAEngine *        engine,
  1039.                                  TQATexture *            texture);
  1040.  
  1041. EXTERN_API_C( void )
  1042. QATextureDelete                    (const TQAEngine *        engine,
  1043.                                  TQATexture *            texture);
  1044.  
  1045. EXTERN_API_C( TQAError )
  1046. QATextureBindColorTable            (const TQAEngine *        engine,
  1047.                                  TQATexture *            texture,
  1048.                                  TQAColorTable *        colorTable);
  1049.  
  1050. EXTERN_API_C( TQAError )
  1051. QABitmapNew                        (const TQAEngine *        engine,
  1052.                                  unsigned long             flags,
  1053.                                  TQAImagePixelType         pixelType,
  1054.                                  const TQAImage *        image,
  1055.                                  TQABitmap **            newBitmap);
  1056.  
  1057. EXTERN_API_C( TQAError )
  1058. QABitmapDetach                    (const TQAEngine *        engine,
  1059.                                  TQABitmap *            bitmap);
  1060.  
  1061. EXTERN_API_C( void )
  1062. QABitmapDelete                    (const TQAEngine *        engine,
  1063.                                  TQABitmap *            bitmap);
  1064.  
  1065. EXTERN_API_C( TQAError )
  1066. QABitmapBindColorTable            (const TQAEngine *        engine,
  1067.                                  TQABitmap *            bitmap,
  1068.                                  TQAColorTable *        colorTable);
  1069.  
  1070. EXTERN_API_C( TQAEngine *)
  1071. QADeviceGetFirstEngine            (const TQADevice *        device);
  1072.  
  1073. EXTERN_API_C( TQAEngine *)
  1074. QADeviceGetNextEngine            (const TQADevice *        device,
  1075.                                  const TQAEngine *        currentEngine);
  1076.  
  1077. EXTERN_API_C( TQAError )
  1078. QAEngineCheckDevice                (const TQAEngine *        engine,
  1079.                                  const TQADevice *        device);
  1080.  
  1081. EXTERN_API_C( TQAError )
  1082. QAEngineGestalt                    (const TQAEngine *        engine,
  1083.                                  TQAGestaltSelector     selector,
  1084.                                  void *                    response);
  1085.  
  1086. EXTERN_API_C( TQAError )
  1087. QAEngineEnable                    (long                     vendorID,
  1088.                                  long                     engineID);
  1089.  
  1090. EXTERN_API_C( TQAError )
  1091. QAEngineDisable                    (long                     vendorID,
  1092.                                  long                     engineID);
  1093.  
  1094.  
  1095. #if TARGET_OS_MAC
  1096. EXTERN_API_C( TQAError )
  1097. QARegisterDrawNotificationProc    (Rect *                    globalRect,
  1098.                                  TQADrawNotificationProcPtr  proc,
  1099.                                  long                     refCon,
  1100.                                  TQADrawNotificationProcRefNum * refNum);
  1101.  
  1102. EXTERN_API_C( TQAError )
  1103. QAUnregisterDrawNotificationProc (TQADrawNotificationProcRefNum  refNum);
  1104.  
  1105. #endif  /* TARGET_OS_MAC */
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114. #if PRAGMA_ENUM_ALWAYSINT
  1115.     #pragma enumsalwaysint reset
  1116. #elif PRAGMA_ENUM_OPTIONS
  1117.     #pragma option enum=reset
  1118. #elif defined(PRAGMA_ENUM_PACK__RAVE__)
  1119.     #pragma options(pack_enums)
  1120. #endif
  1121.  
  1122. #if PRAGMA_STRUCT_ALIGN
  1123.     #pragma options align=reset
  1124. #elif PRAGMA_STRUCT_PACKPUSH
  1125.     #pragma pack(pop)
  1126. #elif PRAGMA_STRUCT_PACK
  1127.     #pragma pack()
  1128. #endif
  1129.  
  1130. #ifdef PRAGMA_IMPORT_OFF
  1131. #pragma import off
  1132. #elif PRAGMA_IMPORT
  1133. #pragma import reset
  1134. #endif
  1135.  
  1136. #ifdef __cplusplus
  1137. }
  1138. #endif
  1139.  
  1140. #endif /* __RAVE__ */
  1141.  
  1142.